﻿using System.Web.Mvc;
using System.Web.Routing;
using Autofac;

namespace Freedom.Framework.Mvc.Routes
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes, IContainer container)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            foreach(var module in Utils.GetModuleInfo())
            {
                var routeProvider = container.ResolveKeyed<IRouteProvider>(string.Format("{0}.RouteProvider", module.Name).ToLower());
                routeProvider.GetRoutes(routes);
            }
        }
    }
}
